﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace SpaceEngine.Assets
{
    public class Station : Asset3D
    {
        Marker marker;
        float hoverTimer;
        float hoverTimerMax;
        short hoverTimerToggle;

        public Station(Game1 game, Vector3 position)
            :base(game,@"Models\space_station_001",1f)
        {
            this.position = position;
            hoverTimer = 0;
            hoverTimerMax = 1000;
            hoverTimerToggle = 1;

            marker = new Marker(game, new Vector3(position.X,0, position.Z),"green");
            game.Components.Add(marker);
        }

        public override void  Update(GameTime gameTime)
        {
            if (hoverTimer >= hoverTimerMax)
            {
                hoverTimer = 0;
                hoverTimerToggle *= -1;
            }

            if (hoverTimerToggle > 0)
                position.Y += .02f;
            else
                position.Y -= .02f;


            hoverTimer += gameTime.ElapsedGameTime.Milliseconds;

            // rotate slowly
            this.rotation.Y += MathHelper.ToRadians(.05f);
 	        base.Update(gameTime);
        }
    }
}
